package battlebarnserver;

import battlebarnserver.entities.InanimateEntity;
import battlebarnserver.entities.PlayerEntity;
import battlebarnserver.util.Constants;
import java.util.Random;
import java.util.Vector;

/**
 *
 * @author johncreecy
 */
public class GenerateGameBoard {

	public void generateInanimates() {
		int randomX = 0;
		int randomY = 0;
		int xyPair = 0;
		Random generator;
		generator = new Random();
		Vector<Integer> previousXYPairs = new Vector<Integer>();
		for (int i = 0; i < Constants.GAME_BOARD_INANIMTES; i++) {
			do {
				randomX = generator.nextInt(Constants.TILE_MAX_X);
				randomY = generator.nextInt(Constants.TILE_MAX_Y);
				xyPair = randomX+randomY;
			} while (previousXYPairs.contains(xyPair));
			previousXYPairs.add(xyPair);
			InanimateEntity inanimateEntity = new InanimateEntity(randomX, randomY);
			BattleBarn.staticGameData.add(inanimateEntity);
		}
	}
	
	public void spawnAIEnemies() {
		Random generator;
		generator = new Random();
		String enemyId;
		for(int i = 0; i < Constants.AI_ENEMIES; i++) {
				enemyId = "AI-" + i;
				PlayerEntity enemy = new PlayerEntity(enemyId, Constants.STARTING_CRITTER_HEALTH, generator.nextInt(Constants.TILE_MAX_X), generator.nextInt(Constants.TILE_MAX_Y), 2, false, true);	
				BattleBarn.actionStack.put(enemyId,enemy);
		}
	}
}
